import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

//懒加载：等调用该组件的时候才加载


const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },  
  {
    title:"订单结算",
    name:"orderList",
    path:"/orderList",
    component: () => import('@/components/orderList.vue')
  },
  {
    title:"付款给商家",
    name:"paycodepage",
    path:"/paycodepage",
    component: () => import('@/views/paycodepage.vue')
  },
  {
    title:"个人收款",
    name:"PayeeQrcode",
    path:"/PayeeQrcode",
    component: () => import('@/views/PayeeQrcodeView.vue')
  },
  {
    title:"扫一扫",
    name:"paymentsweep",
    path:"/paymentsweep",
    component: () => import('@/views/paymentsweep.vue')
  },
  {
    title:"付款页面",
    name:"paymentpage",
    path:"/paymentpage",
    component: () => import('@/views/paymentpage.vue')
  },//PaySuccessful
  {
    title:"付款成功",
    name:"PaySuccessful",
    path:"/PaySuccessful",
    component: () => import('@/views/PaySuccessful.vue')
  },
  {
    title:"付款失败",
    name:"PayError",
    path:"/PayError",
    component: () => import('@/views/PayError.vue')
  },
  {
    title:"注册页面",
    name:"RegView",
    path:"/RegView",
    component: () => import('@/views/RegView.vue')
  },
  {
    title:"登录页面",
    name:"Login",
    path:"/login",
    component: () => import('@/views/LoginView.vue')
  },
  {
    title:"我的",
    name:"personal",
    path:"/personal",
    component: () => import('@/views/PersonalView.vue')
  },
  {
    title:"钱包",
    name:"PayPackView",
    path:"/paypack",
    component: () => import('@/views/PayPackView.vue')
  },
  {
    title:"消息",
    name:"MessageView",
    path:"/message",
    component: () => import('@/views/MessageView.vue')
  },
  {
    title:"设置",
    name:"SettingView",
    path:"/setting",
    component: () => import('@/views/SettingView.vue')
  },
]

// 解决导航重复
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
